package model

/*******************************************************************************
Copyright:cloud
Author:cloudapex@126.com
Version:1.0
Date:2020-09-29
Description: CRM用户管理
*******************************************************************************/
import (
	"context"
	"service/ctrl"
	"service/model/mod"

	gpb "gitee.com/cloudapex/protos/hr/pb"

	"google.golang.org/grpc"
)

var CrmUser user

func init() {
	ctrl.GCon.RegistClienter(mod.GCONN_HR, func(c *grpc.ClientConn) { CrmUser.cli = gpb.NewUserInfoClient(c) })
}

type user struct {
	cli gpb.UserInfoClient
}

// user.UserList 用户列表
func (this *user) UserList(ctx context.Context, in *gpb.UserInfoListReq) (*gpb.UserInfoListRes, error) {
	return this.cli.UserList(ctx, in)
}

// user.UserAdd 编辑用户
func (this *user) UserAdd(ctx context.Context, in *gpb.UserReq) (*gpb.UserRes, error) {
	return this.cli.UserCreate(ctx, in)
}

// user.UserUpd 编辑用户
func (this *user) UserUpd(ctx context.Context, in *gpb.UserReq) (*gpb.UserRes, error) {
	return this.cli.UserUpdate(ctx, in)
}

// user.UserSta 更改用户状态
func (this *user) UserSta(ctx context.Context, in *gpb.UserInfoStatusReq) (*gpb.UserRes, error) {
	return this.cli.UserUpdateStatus(ctx, in)
}

// user.UserPwd 重置密码
func (this *user) UserPwd(ctx context.Context, in *gpb.UserReq) (*gpb.UserRes, error) {
	return this.cli.UserUpdate(ctx, in)
}
func (this *user) UserNoRelationList(ctx context.Context, in *gpb.HrInfoListReq) (*gpb.HrInfoListRes, error) {
	return this.cli.UserNoRelationList(ctx, in)
}
